package com.bookpavilion.order.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import com.bookpavilion.order.pojo.Order;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.xml.crypto.Data;
import java.util.Date;

/**
 * 数据访问接口
 * @author Administrator
 *
 */
public interface OrderDao extends JpaRepository<Order,String>,JpaSpecificationExecutor<Order>{


    @Modifying
    @Query("update Order set update_time=?2 where id=?1")
    public void updateUpdateTimeById(String id, Date updateTime);

    @Modifying
    @Query("update Order set payment_time=?2 where id=?1")
    public void updatePaymentTimeById(String id, Date paymentTime);

    @Modifying
    @Query("update Order set end_time=?2 where id=?1")
    public void updateEndTimeById(String id, Date endTime);

    @Modifying
    @Query("update Order set close_time=?2 where id=?1")
    public void updateCloseTimeById(String id, Date closeTime);

    @Modifying
    @Query("update Order set status=?2 where  id=?1")
    public void updateStatusById(String id,Integer status);

    @Modifying
    @Query("update Order set consign_time=?2 where  id=?1")
    void updateConsignTimeById(String id, Date date);

    @Modifying
    @Query("update Order set shipping_name=?2 ,shipping_code=?3 where id=?1")
    void updateShippingMsg(String id, String shippingName, String shippingCode);
}
